package com.yc.projects.pro2_bootmail;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application implements CommandLineRunner {

    @Autowired
    private EmailService emailService;

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        // 发送邮件示例
        String to = "2811659979@qq.com"; // 接收者的邮箱地址
        String subject = "烦死了喵";
        String text = "springboot配置好麻烦呀我要创死世界";

        emailService.sendEmail(to, subject, text);
    }
}
